#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,a,i,n5=0,n10=0,n1=0;
	cin>>k;
	for(i=1;i<=k;i++)
	{
		cin>>a;
		switch(a)
		{
			case 1:n1++;break;
			case 5:n5++;break;
			case 10:n10++;break;
			default:break;
		}
	}
	cout<<n1<<endl<<n5<<endl<<n10;
    return 0;
}

